// Copyright 2011 Google Inc. All Rights Reserved.

/**
 * @fileoverview This is the root module for the net-score feather test.
 *
 * @author gavaletz@google.com (Eric Gavaletz)
 *
 * This test is designed to run unobtrusively and does not provide a visual
 * indication that a test has been run.
 */


goog.provide('feather');


goog.require('datastore');
goog.require('late');
goog.require('page');
goog.require('thr');
goog.require('track');


//TODO(gavaletz) #34 Reduce the DL size for feather tests
/**
 * The test in progress.
 *
 * @type {string}
 */
feather.testName;


/**
 * Status of the test in progress.
 *
 * @type {string}
 */
feather.testMessage;


/**
 * The test progress.
 *
 * @type {number}
 */
feather.testProgress;


/**
 * Don't display a progress bar for feather tests.
 *
 * To reduce the size of the download we are not using the progress bar.
 *
 * @param {number} value The amount of progress that has been made.
 */
page.progressSetProgressBar = function(value) {feather.testProgress = value;};


/**
 * The main entry point for a net-score feather test.
 *
 * Sets up the testing order and calls the first function in the chain of tests
 * to be run.
 */
feather.start = function() {
  page.featherSetup();
  track.trackMe(track.trackingCode);
  track.userAgent();
  late.nextFunction = thr.start;
  thr.nextFunction = datastore.postJson;
  try {
    late.start();
  }
  catch (err) {
    datastore.logError('featherError', err);
    try {
      datastore.postJson();
    }
    catch (err) {
      datastore.logError('postJsonError', err);
    }
  }
};
//used by the closure compiler to eport this function call
goog.exportProperty(window, 'featherStart', feather.start);
